package com.zretc.controller;


import com.zretc.entity.Sales;
import com.zretc.service.ComSaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@CrossOrigin
@RequestMapping("/saleroom")
public class ComSaleController {

    @Autowired
    private ComSaleService comSaleService;

    @RequestMapping("/getSaleroom")
    @ResponseBody
    public List<Map<String, Object>> getSaleroom(@RequestParam(value = "sellerAccount") String sellerAccount,
                               String salesDate,//查询某月的总销售额格式yyyy-mm
                               String salesDateYear,//年销售额 格式yyyy
                               String salesDateBet,//salesDateBet和salesDateBetween xx月xx日到xx月xx日格式yyyy-mm-dd
                               String salesDateBetween){
        Map<String,Object> param = new HashMap<>();
        param.put("sellerAccount",sellerAccount);
        param.put("salesDate",salesDate);
        param.put("salesDateYear",salesDateYear);
        param.put("salesDateBet",salesDateBet);
        param.put("salesDateBetween",salesDateBetween);
        List<Map<String, Object>> salesList = comSaleService.getSalesBySellerAccount(param);
        return salesList;
    }


}
